//
//  MyLocationParser.m
//  RegBars
//
//  Created by Hai Nguyen on 10/3/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MyLocationParser.h"

@implementation MyLocationParser
@synthesize delegate;

- (void) findMyLocation:(NSString*) Url{
	NSString *fileContent = [NSString stringWithContentsOfURL:[NSURL URLWithString:Url] encoding:NSUTF8StringEncoding error:nil];  
	SBJSON *parser = [[SBJSON alloc] init];
	
	NSDictionary *data = (NSDictionary *) [parser objectWithString:fileContent error:nil];  

	// getting the data from inside of "menu"  
	NSArray *menu = (NSArray *) [data objectForKey:@"results"];
	
	//NSLog(@"Ad",[[menu objectAtIndex:0] objectForKey:@"formatted_address"]);
	
	[delegate didEndFindMyLocation:[[menu objectAtIndex:0] objectForKey:@"formatted_address"]];
	
}

- (void) dealloc{
	[super dealloc];
}

@end
